/************************************************************************************
 RC Hobby Stream
 Twitter automatic feeder

 First version developed with support of Mapelgate Media

"RC Hobby Stream" is protected by the copyright law
© 2011 Enrico Miglino / Tech Consulting (enrico.miglino@ovi.com)
Distributed under the LGPL 3.0 license.

This file is part of "RC Hobby Stream".

    "RC Hobby Stream" is free software: you can redistribute it
    and/or modify it under the terms of the Lesser GNU General Public License
    as published by the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    "RC Hobby Stream" is distributed in the hope that it
    will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    Lesser GNU General Public License for more details.

    You should have received a copy of the Lesser GNU General Public License
    along with "RC Hobby Stream".
    If not, see <http://www.gnu.org/licenses/>.
************************************************************************************/

import Qt 4.7

Item {
    id: toolbarSetup    // Options toolbar for the user setup

    width: 160; height: 210


    // Aliases fot the parametric text strings
    property alias button1Label: button1.text
    property alias button2Label: button2.text
    property alias button3Label: button3.text
    property alias button4Label: button4.text
    property alias button5Label: button5.text
    property alias title: toolbarTitle.text

    // Aliases for the button flags
    property alias button1Flag: button1.flagSet
    property alias button2Flag: button2.flagSet
    property alias button3Flag: button3.flagSet
    property alias button4Flag: button4.flagSet
    property alias button5Flag: button5.flagSet

    // Aliases for the button flag changed signal
    property alias button1Changed: button1.flagChanged
    property alias button2Changed: button2.flagChanged
    property alias button3Changed: button3.flagChanged
    property alias button4Changed: button4.flagChanged
    property alias button5Changed: button5.flagChanged

    // Aliases to initialize button image depending on the initial flag status

    // Signals for all the buttons
    signal button1Clicked
    signal button2Clicked
    signal button3Clicked
    signal button4Clicked
    signal button5Clicked

    // Relative position settings
    property int btnLeftMargin: 5       // Buttons margins
    property int btnVertOffset: 32      // Buttons vertical shift offset
    property int yTitle: 10             // Title vertical position
    property int yStart: 40             // Button top starting position
    property int buttonOptionHeight: 24 // Button show sizes
    property int buttonOptionWidth: 24

    // ---------------------------------------------------------- START DEBUG BLOCK
    // Debug info.
    // For debug console messages use debugMessage(msg) instead of console.log(msg)
    // in the source module set baseMsg property with the string that should appear
    // before any debug message on the console.
    // To disable debug, set debugStatus to false. This can be done also only in some
    // code blocks.
    property bool debugStatus: true
    property string baseMsg: "*** Debug ToolBarSetup: "
    function debugMessage(msg) { if (debugStatus == true) console.log(baseMsg + msg); }
    // ---------------------------------------------------------- END DEBUG BLOCK

    focus:true

    Rectangle {
        id: setupBackground
        width: parent.width; height: parent.height
        color: "#216778"; smooth: true; radius: 15; opacity: 0.8
    }

    Text {
        id: toolbarTitle // Toolbar Title
        color: "#D0D0D0"    // Text color
        anchors.horizontalCenter: parent.horizontalCenter; y: yTitle
        style: Text.Raised; styleColor: "black"
        font.pointSize: 12; font.bold: true
    }

    // Options buttons definitions
    ButtonSetup {
        id: button1

        height: buttonOptionHeight; width: buttonOptionWidth
        anchors.left: parent.left;
        // Relative vertical top position
        y: parent.yStart;
        // BUtton marginButton
        anchors.leftMargin: parent.btnLeftMargin;

        onClicked: toolbarSetup.button1Clicked(); // Event function callback
        focus:true

    }

    ButtonSetup {
        id: button2

        height: buttonOptionHeight; width: buttonOptionWidth
        anchors.left: parent.left;
        // Relative vertical top position
        y: parent.yStart + parent.btnVertOffset;
        // BUtton margin
        anchors.leftMargin: parent.btnLeftMargin;

        onClicked: toolbarSetup.button2Clicked(); // Event function callback
    }

    ButtonSetup {
        id: button3

        height: buttonOptionHeight; width: buttonOptionWidth
        anchors.left: parent.left;
        // Relative vertical top position
        y: parent.yStart + parent.btnVertOffset * 2;
        // BUtton margin
        anchors.leftMargin: parent.btnLeftMargin;

        onClicked: toolbarSetup.button3Clicked(); // Event function callback
    }

    ButtonSetup {
        id: button4

        height: buttonOptionHeight; width: buttonOptionWidth
        anchors.left: parent.left;
        // Relative vertical top position
        y: parent.yStart + parent.btnVertOffset * 3;
        // BUtton margin
        anchors.leftMargin: parent.btnLeftMargin;

        onClicked: toolbarSetup.button4Clicked(); // Event function callback
    }

    ButtonSetup {
        id: button5

        height: buttonOptionHeight; width: buttonOptionWidth
        anchors.left: parent.left;
        // Relative vertical top position
        y: parent.yStart + parent.btnVertOffset * 4;
        // BUtton margin
        anchors.leftMargin: parent.btnLeftMargin;

        onClicked: toolbarSetup.button5Clicked(); // Event function callback
    }
}
